home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / languages / turbo_part1.lha / modula / amiga / SCSIDisk.def < prev    next >
Encoding:
Text File  |  1994-11-09  |  4.2 KB  |  108 lines

  1. DEFINITION FOR C MODULE SCSIDisk ;
  2.  
  3. FROM SYSTEM IMPORT SHORTSET, ADDRESS ;
  4.  
  5. (*--------------------------------------------------------------------
  6.  *
  7.  *   SCSI Command
  8.  *    Several Amiga SCSI controller manufacturers are converging on
  9.  *    standard ways to talk to their controllers.  This include
  10.  *    file describes an exec-device command (e.g. for hddisk.device)
  11.  *    that can be used to issue SCSI commands
  12.  *
  13.  *   UNIT NUMBERS
  14.  *    Unit numbers to the OpenDevice call have encoded in them which
  15.  *    SCSI device is being referred to.  The three decimal digits of
  16.  *    the unit number refer to the SCSI Target ID (bus address) in
  17.  *    the 1's digit, the SCSI logical unit (LUN) in the 10's digit,
  18.  *    and the controller board in the 100's digit.
  19.  *
  20.  *    Examples:
  21.  *          0    drive at address 0
  22.  *         12    LUN 1 on multiple drive controller at address 2
  23.  *        104    second controller board, address 4
  24.  *         88    not valid: both logical units and addresses
  25.  *            range from 0..7.
  26.  *
  27.  *   CAVEATS
  28.  *    Original 2090 code did not support this command.
  29.  *
  30.  *    Commodore 2090/2090A unit numbers are different.  The SCSI
  31.  *    logical unit is the 100's digit, and the SCSI Target ID
  32.  *    is a permuted 1's digit: Target ID 0..6 maps to unit 3..9
  33.  *    (7 is reserved for the controller).
  34.  *
  35.  *        Examples:
  36.  *          3    drive at address 0
  37.  *        109    drive at address 6, logical unit 1
  38.  *          1    not valid: this is not a SCSI unit.  Perhaps
  39.  *            it's an ST506 unit.
  40.  *
  41.  *    Some controller boards generate a unique name (e.g. 2090A's
  42.  *    iddisk.device) for the second controller board, instead of
  43.  *    implementing the 100's digit.
  44.  *
  45.  *    There are optional restrictions on the alignment, bus
  46.  *    accessability, and size of the data for the data phase.
  47.  *    Be conservative to work with all manufacturer's controllers.
  48.  *
  49.  *------------------------------------------------------------------*)
  50.  
  51. CONST
  52.   HD_SCSICMD = 28 ; (* issue a SCSI command to the unit     *)
  53.             (* io_Data points to a SCSICmd        *)
  54.             (* io_Length is sizeof(struct SCSICmd)  *)
  55.             (* io_Actual and io_Offset are not used *)
  56.  
  57. TYPE
  58.   SCSICmd = RECORD
  59.     scsi_Data      : ADDRESS  ;     (* word aligned data for SCSI Data Phase     *)
  60.                  (* (optional) data need not be byte aligned  *)
  61.                  (* (optional) data need not be bus accessable*)
  62.     scsi_Length    : LONGINT  ;     (* even length of Data area              *)
  63.                  (* (optional) data can have odd length          *)
  64.                  (* (optional) data length can be > 2**24     *)
  65.     scsi_Actual    : LONGINT  ;     (* actual Data used                  *)
  66.     scsi_Command   : ADDRESS  ;     (* SCSI Command (same options as scsi_Data)  *)
  67.     scsi_CmdLength : CARDINAL ;     (* length of Command                  *)
  68.     scsi_CmdActual : CARDINAL ;     (* actual Command used                  *)
  69.     scsi_Flags     : SHORTSET ;     (* includes intended data direction           *)
  70.     scsi_Status    : SHORTCARD;     (* SCSI status of command              *)
  71.     scsi_SenseData : ADDRESS  ;     (* sense data: filled if SCSIF_[OLD]AUTOSENSE*)
  72.                  (* is set and scsi_Status has CHECK CONDITION*)
  73.                  (* (bit 1) set                      *)
  74.     scsi_SenseLength : CARDINAL ;(* size of scsi_SenseData, also bytes to     *)
  75.                  (* request w/ SCSIF_AUTOSENSE, must be 4..255*)
  76.     scsi_SenseActual : CARDINAL ;(* amount actually fetched (0 means no sense)*)
  77.   END ;
  78.  
  79. CONST
  80. (*----- scsi_Flags -----*)
  81.   SCSIF_WRITE       = { };    (* intended data direction is out    *)
  82.   SCSIF_READ       = {0};    (* intended data direction is in    *)
  83.   SCSIB_READ_WRITE =  0 ;    (* (the bit to test)            *)
  84.  
  85.   SCSIF_NOSENSE       = { } ;    (* no automatic request sense        *)
  86.   SCSIF_AUTOSENSE  = {1} ;    (* do standard extended request sense    *)
  87.                 (* on check condition            *)
  88.   SCSIF_OLDAUTOSENSE = {1,2} ;    (* do 4 byte non-extended request    *)
  89.                 (* sense on check condition        *)
  90.   SCSIB_AUTOSENSE    = 1 ;    (* (the bit to test)            *)
  91.   SCSIB_OLDAUTOSENSE = 2 ;    (* (the bit to test)            *)
  92.  
  93. (*----- SCSI io_Error values -----*)
  94.  
  95. CONST
  96.   HFERR_SelfUnit    = 40 ; (* cannot issue SCSI command to self *)
  97.   HFERR_DMA        = 41 ; (* DMA error                *)
  98.   HFERR_Phase        = 42 ; (* illegal or unexpected SCSI phase  *)
  99.   HFERR_Parity        = 43 ; (* SCSI parity error            *)
  100.   HFERR_SelTimeout    = 44 ; (* Select timed out            *)
  101.   HFERR_BadStatus    = 45 ; (* status and/or sense error        *)
  102.  
  103. (*----- OpenDevice io_Error values -----*)
  104.  
  105.   HFERR_NoBoard        = 50 ; (* Open failed for non-existant board *)
  106.  
  107. END SCSIDisk.
  108.